import HTTP from '../utils/http';
import { API} from '../config/config';

const { CRAWLER } = API;

export default class Crawler extends HTTP {
  async crawlAction (apiName) {
    return new Promise((resolve, reject) => {
      this.axiosPost({
        url: CRAWLER.CRAWL_ACTION,
        data: {
          apiName
        },
        success(data) {
          resolve(data);
        },
        error(error) {
          alert('网络请求失败');
          // window.location.reload();
        }
      })
    });
  }
} 